package com.aj.http.response;

import org.json.JSONObject;

import com.aj.databases.entry.User;

public class UserResponse extends BaseRespond {
	private User user;

	public UserResponse(JSONObject json) {
		super(json);
		try {
			if (common != null && common.getResult() != null) {
				JSONObject jsonObject = common.getResult();
				user = new User();
				if (!jsonObject.isNull("userId")) {
					user.setUser_id(jsonObject.getString("userId"));
				}
				if (!jsonObject.isNull("userTel")) {
					user.setPhohe(jsonObject.getString("userTel"));
				}
				if (!jsonObject.isNull("nickName")) {
					user.setNickName(jsonObject.getString("nickName"));
				}
				if (!jsonObject.isNull("trueName")) {
					user.setName(jsonObject.getString("trueName"));
				}
				if (!jsonObject.isNull("sex")) {
					user.setSex(jsonObject.getString("sex"));
				}
				if (!jsonObject.isNull("birthday")) {
					user.setBirthday(jsonObject.getString("birthday"));
				}
				if (!jsonObject.isNull("address")) {
					user.setAddress(jsonObject.getString("address"));
				}
				if (!jsonObject.isNull("sign")) {
					user.setSign(jsonObject.getString("sign"));
				}
				if (!jsonObject.isNull("photo")) {
					user.setPortrait_url(jsonObject.getString("photo"));
				}
				if (!jsonObject.isNull("isMarried")) {
					user.setIsMarried(jsonObject.getString("isMarried"));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
